package com.hong.concurrent.chapter18;

/**
 * @Author csh
 * @Description
 * @Date 2018/7/12 21:10
 */
class Servant implements ActiveObject {
    @Override
    public Result makeString(int count, char fillChar) {
        char[] buf = new char[count];
        for (int i =0;i<count;i++){
            buf[i] = fillChar;
            try {
                Thread.sleep(10);
            }catch (Exception e){

            }
        }
        return new RealResult(new String(buf));
    }

    @Override
    public void displayString(String text) {
        try {
            System.out.println("Display:"+text);
            Thread.sleep(10);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
